<?php

trait Shell
{
    public function execCommand($command, $bLog = True)
    {
        $output = null;
        $result = null;
        exec($command, $output, $result);
        $out = empty($output) ? '' : implode("\r", $output);
        if ($bLog && $result != '0') {
            Yii::log('status:' . $result . ',out:' . $out . ',command:' . $command, CLogger::LEVEL_ERROR, 'shell');
        }
        return array('status' => $result, 'out' => $out);
    }

}